<?php
// 管理兑换码活动
namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CodeActivity extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'value',
        'total_codes',
        'product_id',
        'end_time',
        'is_active'
    ];

    protected $casts = [
        'end_time' => 'datetime',
        'is_active' => 'boolean',
    ];

    public function verificationCodes()
    {
        return $this->hasMany(VerificationCode::class);
    }

    public function product()
    {
        return $this->belongsTo(Product::class);
    }
} 